PROJECTENGRAM

SUBSTITUTION METHOD

Substitution Method

Tags: #◇CCDSALG #◇Algorithms #◇Computer Science #◇Computational Complexity #◇Efficiency #◇Algorithm Design Paradigms #◇Recursion #◇Recursion and Iteration #◇Analysis of Algorithms #◇Data Structures #◇Time Complexity #◇Space Complexity


◇Overview

The Substitution Method solves recurrences by guessing the form of the solution and then proving it correct using mathematical induction.

◇Key Concepts

Two-step process: guess then prove Requires mathematical induction The guess can come from the ◇Recursion Tree Method or intuition Must find appropriate constants cc and n0n_0

◇Details / Theory

Steps

  1. Guess the form of the solution (e.g., T(n)=O(nlog⁡n)T(n) = O(n \log n)).
  2. Prove the guess is correct using mathematical induction:
    Base case: Verify T(n0)≤c⋅g(n0)T(n_0) \leq c \cdot g(n_0) for some small n0n_0.
    Inductive step: Assume T(k)≤c⋅g(k)T(k) \leq c \cdot g(k) for all k<nk < n, then show T(n)≤c⋅g(n)T(n) \leq c \cdot g(n).

Worked Example: T(n)=2T(n/2)+nT(n) = 2T(n/2) + n

Guess: T(n)=O(nlog⁡n)T(n) = O(n \log n), i.e., T(n)≤cnlog⁡nT(n) \leq cn \log n for some c>0c > 0.

Inductive Hypothesis: Assume T(k)≤cklog⁡kT(k) \leq ck \log k for all k<nk < n.

Inductive Step:
T(n)=2T(n/2)+nT(n) = 2T(n/2) + n
≤2⋅c(n/2)log⁡(n/2)+n\leq 2 \cdot c(n/2)\log(n/2) + n
=cn(log⁡n−log⁡2)+n= cn(\log n - \log 2) + n
=cnlog⁡n−cn+n= cn \log n - cn + n
≤cnlog⁡n(when c≥1)\leq cn \log n \quad \text{(when } c \geq 1\text{)}

Thus T(n)=O(nlog⁡n)T(n) = O(n \log n). □\square

Worked Example: T(n)=T(n/2)+1T(n) = T(n/2) + 1

Guess: T(n)=O(log⁡n)T(n) = O(\log n), i.e., T(n)≤clog⁡nT(n) \leq c \log n.

Inductive Step:
T(n)=T(n/2)+1≤clog⁡(n/2)+1=clog⁡n−c+1≤clog⁡n(when c≥1)T(n) = T(n/2) + 1 \leq c \log(n/2) + 1 = c\log n - c + 1 \leq c\log n \quad \text{(when } c \geq 1\text{)}

Tips for Guessing

Use the ◇Recursion Tree Method to get intuition for the bound. Try common forms: O(n)O(n), O(nlog⁡n)O(n \log n), O(n2)O(n^2), O(log⁡n)O(\log n). If the proof fails, try a tighter or looser bound. Sometimes subtracting a lower-order term in the hypothesis helps (e.g., T(n)≤cnlog⁡n−dnT(n) \leq cn \log n - dn).

◇Common Pitfalls

Making the inductive hypothesis too weak or too strong. Forgetting to verify the base case. Using OO-notation in the inductive proof instead of concrete constants (must use actual cc).

◇Summary

TL;DR — The Substitution Method guesses a closed-form solution to a recurrence and proves it via mathematical induction. The guess can come from intuition or the Recursion Tree Method.

Related: ◇Master Theorem — ◇Recursion Tree Method — ◇Divide and Conquer — ◇Asymptotic Notation — ◇Correctness Source / Reference: Handout 03

◇References & Navigation

CONFIRMATION // 理解度の確認

ACTIVE RECALL VERIFICATION

Select an answer to verify conceptual comprehension and reveal the technical rationale.

Q1

What are the two main steps of the Substitution Method?

Q2

What mathematical technique is fundamental to proving the guess in the Substitution Method?

Q3

In the Substitution Method, where can the initial "guess" come from?

Q4

What is verified in the "Base case" of the inductive proof?

Q5

In the Inductive step, what do you assume to be true?

Q6

In the worked example T(n)=2T(n/2)+nT(n) = 2T(n/2) + n, what is the guessed bound?

Q7

What is a common tip if your initial guess in the substitution method fails to prove?

Q8

What is a common pitfall when executing the inductive proof?

Q9

If T(n)=T(n/2)+1T(n) = T(n/2) + 1, what is the mathematically proven upper bound using substitution?

Q10

Why must you find an appropriate constant cc during the proof?

Substitution Method | PROJECT ENGRAM